#ifndef SERVERAHORCADO_H
#define SERVERAHORCADO_H
#include "Ahorcado.h"
#include <string>
#include "RakNetTypes.h"
#include <map>
class InLobbyClients;
class ServerAhorcado: public Ahorcado
{
private:
	//Attributes
	//Raknet config
	RakNet::RakPeerInterface *peer;
	RakNet::SocketDescriptor sd;
	//Game attributes
	int numPlayers;
	std::map<std::string,RakNet::SystemAddress> playersNames;
	std::string winningWord;
	char* correctLetters;
	char* incorrectLetters; 

public:
	//Constructors
	ServerAhorcado();
	~ServerAhorcado();
	//Start
	bool startServer();
	//Main loop
	void managePackages() override;
	void update() override;
	

private:
	//Choose a word
	void selectWinningWord();
	bool validateWord();
	//Server configuration
	void configurateServer();
	//After lobby
	void startGame();
	//While in lobby
	void lobbyState();
	bool validateToStartGame(InLobbyClients* );
	void lobbyScreenWriter(InLobbyClients *lc);
	//During game
	void initializeGameAttributes();
	bool checkLetter(char);
	bool isWordCompletted();
};

#endif